package com.xxx.pojo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.xxx.enums.SexEnum;
import com.xxx.enums.StatusEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDate;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("`user`")
public class User implements Serializable {
    @ExcelProperty("登录名字")
    @ColumnWidth(20)
    private String loginName;
    @ExcelProperty("姓名")
    @ColumnWidth(20)
    @TableField("`name`")
    private String name;
    @ExcelProperty("密码")
    @ColumnWidth(20)
    @TableField(value = "`password`")
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;
    @ExcelProperty("性别")
    @ColumnWidth(20)
    private SexEnum sex;
    @ExcelProperty("id")
    @ColumnWidth(20)
    @TableId(type = IdType.ASSIGN_ID)
    //过长前端接收long类型会丢失精度  所以要转成string
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long userId;

    @ExcelProperty("电话")
    @ColumnWidth(20)
    private String phone;

    @ExcelProperty("邮箱")
    @ColumnWidth(20)
    private String email;
    @ExcelProperty("创建时间")
    @ColumnWidth(20)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate createTime;
    @ExcelProperty("修改时间")
    @ColumnWidth(20)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate updateTime;
    @ExcelProperty("创建用户")
    @ColumnWidth(20)
    private String createUser;
    @ExcelProperty("修改用户")
    @ColumnWidth(20)
    private String updateUser;
    @ExcelProperty("状态")
    @ColumnWidth(20)
    private StatusEnum status;
    @ExcelProperty("删除")
    @ColumnWidth(20)
    @TableField("`delete`")
    @TableLogic // 标记为逻辑删除字段
    private Integer delete;


}
